package com.demo.study.base.demos;


public class Demo2_Static {
    public static void main(String[] args) {
        System.out.println(DemoTest.name);
        System.out.println("------------------");
        DemoTest test = new DemoTest();
        System.out.println(test.getName());
    }
}

class DemoTest{
    public static String name = "张三";

    public DemoTest() {
        System.out.println("构造函数被执行了");
    }

    static {
        System.out.println("静态代码块执行了");
    }

    public String getName() {
        return name;
    }
}
